import request from './http.js'

export default {

	// 查询指定位置的广告信息
	getAdvertList(position = 1) {
		return request({
			url: `/article/api/advert/show/${position}`
		})
	},

	// 查询分类与标签信息
	getCategoryList() {
		return request({
			url: '/article/api/category/label/list'
		})
	},

	// 条件分页查询课程列表 query条件对象{isFree: 0}，current当前页码，size每页显示多少条
	getListt(query, current, size) {
		return request({
			url: '/course/api/course/search',
			method: 'POST',
			data: {
				...query,
				current,
				size
			} // {isFree: 0, current: current, size: size}
		})
	},
	// 通过文章id查询文章详情
	getArticleById(articleId) {
		return request({
			url: `/article/api/article/${articleId}`,
			method: 'GET'
		})
	},
	getnav() {
		return request({
			url: `/article/api/category/label/list`,
			method: "GET"
		})
	},
	getlogn(mes) {
		return request({
			url: `/auth/login`,
			method: "POST",
			data: {
				code: mes.code,
				mobile: mes.mobile
			}
		})
	},
	logout(mes) {
		return request({
			url: `/auth/logout?accessToken=`+mes,
			method: "GET",
		
		})
	},
	getdetail(mes) {
		return request({
			url: `${mes}`,
			method: "GET"
		})
	},
	getList(query, res) {
		if (!res) {
			var res = 'course'
		}
		return request({
			url: '/' + res + '/api/' + res + '/search',
			method: 'POST',
			data: {
				...query,
			}
		})
	},

}
